<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of SparqlResult
 *
 * @author peyet
 */
class SparqlBinding {
	private $value;
	private $type;
	private $lang;
	
	public function __construct(stdClass $result) {
		if (isset($result->value)) {
			$this->value = $result->value;
		} else {
			$this->value = null;
		}
		
		if (isset($result->type)) {
			$this->type = $result->type;
		} else {
			$this->type = null;
		}
		
		if (isset($result->{"xml:lang"})) {
			$this->lang = $result->{"xml:lang"};
		} else {
			$this->lang = null;
		}
	}
	
	public function getType() {
		return $this->type;
	}
	
	public function getValue() {
		return $this->value;
	}
	
	public function getLang() {
		return $this->lang;
	}


	public function __toString() {
		return $this->getValue();
	}
}
